<?php

namespace App\Services\Account;

use Illuminate\Database\Eloquent\Relations\HasMany;

class AccountGoldCashes extends AccountAbstract
{
    protected function account(): HasMany
    {
        return $this->user->goldCashes();
    }

    /*---------- plus --------------------------------------------------------------------------------------------------*/

    public function plusInitialCashes($money, $data = [])
    {
        $money = big_decimal($money);
        $this->record($money, 'init_gold_cashes', '初始抢购金', $data);
    }

	public function plusCashesFromBeans($money, $data = [])
	{
		$money = big_decimal($money);
		$this->record($money, 'gold_cashes_from_beans', '金豆兑换抢购金', $data);
	}

    public function plusSupportedCashes($money, $data = [])
    {
        $money = big_decimal($money);
        $this->record($money, 'support_gold_cashes', '平台扶持抢购金', $data);
    }

	public function plusChildFirstRecordCashes($money, $data = [])
	{
		$money = big_decimal($money);
		$this->record($money, 'child_first_gold_record_cashes', '直邀见习赠送抢购金', $data);
	}

	public function plusPresentCashes($money, $data = [])
	{
		$money = big_decimal($money);
		$this->record($money, 'present_gold_cashes', '平台赠送抢购金', $data);
	}

	public function plusTransferedCashes($money, $data = [])
	{
		$money = big_decimal($money);
		$this->record($money, 'transfered_in_cashes', '转入', $data);
	}

	/*---------- minus -------------------------------------------------------------------------------------------------*/

    public function minusStormPaid($money, $data = [])
    {
        $money = big_decimal($money)->multipliedBy(-1);
        $this->record($money, 'pay_gold_record', '黄金风爆订单支出', $data);
    }

	public function minusTransferedCashes($money, $data = [])
	{
        $money = big_decimal($money)->multipliedBy(-1);
		$this->record($money, 'transfered_out_cashes', '转出', $data);
	}

    public function minusSystemRecall($money, $data = [])
    {
        $money = big_decimal($money)->multipliedBy(-1);
        $this->record($money, 'system_recall', '系统回收', $data);
    }
}
